package sample3.evaluators;

import sample3.visitor.Visitor;

public class PlusEvaluator implements Evaluator {

	public Evaluator op1;
	public Evaluator op2;

	public PlusEvaluator(Evaluator op1, Evaluator op2) {
		super();
		this.op1 = op1;
		this.op2 = op2;
	}

	public int evaluate() {
		return op1.evaluate() + op2.evaluate();
	}

	public String toTreeString(String indent) {
		return "\n" + indent + "Plus" + op1.toTreeString(indent + " ")
				+ op2.toTreeString(indent + " ");
	}

	public void accept(Visitor visitor) {
		visitor.visit(this);
	}
}
